package com.yundingai.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

/**
 * 学科表，记录学科相关信息
 * @TableName study_subject
 */
@TableName(value ="study_subject")
@Data
public class StudySubject {
    /**
     * 课程id
     */
    @TableId(type = IdType.AUTO)
    private Integer subjectId;

    /**
     * 课程名称
     */
    private String subjectName;

    /**
     * 课程分类（语数外）
     */
    private String subjectCategory;

    /**
     * 课程等级（几年级）
     */
    private String subjectLevel;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        StudySubject other = (StudySubject) that;
        return (this.getSubjectId() == null ? other.getSubjectId() == null : this.getSubjectId().equals(other.getSubjectId()))
            && (this.getSubjectName() == null ? other.getSubjectName() == null : this.getSubjectName().equals(other.getSubjectName()))
            && (this.getSubjectCategory() == null ? other.getSubjectCategory() == null : this.getSubjectCategory().equals(other.getSubjectCategory()))
            && (this.getSubjectLevel() == null ? other.getSubjectLevel() == null : this.getSubjectLevel().equals(other.getSubjectLevel()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getSubjectId() == null) ? 0 : getSubjectId().hashCode());
        result = prime * result + ((getSubjectName() == null) ? 0 : getSubjectName().hashCode());
        result = prime * result + ((getSubjectCategory() == null) ? 0 : getSubjectCategory().hashCode());
        result = prime * result + ((getSubjectLevel() == null) ? 0 : getSubjectLevel().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", subjectId=").append(subjectId);
        sb.append(", subjectName=").append(subjectName);
        sb.append(", subjectCategory=").append(subjectCategory);
        sb.append(", subjectLevel=").append(subjectLevel);
        sb.append("]");
        return sb.toString();
    }
}